import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:mobx/mobx.dart';

T useObservable<T>(T Function() reactionFunction){
    final state = useState<T>(reactionFunction());
    useEffect((){
        final dispose = reaction((_) => reactionFunction(), (value) {
            state.value = value;
        },fireImmediately: false);
        return (){
            dispose();
        };
    },[]);
    return state.value;
}